package svc

import (
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
	"karnin-zero-admin/service/user/api/internal/config"
)

type ServiceContext struct {
	Config config.Config
	GormDB *gorm.DB
}

func NewServiceContext(c config.Config) *ServiceContext {
	db, _ := gorm.Open(mysql.New(mysql.Config{
		DSN: c.Gorm.DSN,
	}))
	return &ServiceContext{
		Config: c,
		GormDB: db,
	}
}
